package qianfeng.com.meijiadaka.viewholder;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;

import cn.lemon.view.adapter.BaseViewHolder;
import qianfeng.com.meijiadaka.R;
import qianfeng.com.meijiadaka.bean.Home_infoAll;

/**
 * Created by yanshihao on 2017/2/8.
 */

public class VideoViewHolder extends BaseViewHolder<Home_infoAll.ResultBean.VideoBean> {
    private TextView tv1,tv2;
    private ImageView iv;

    public VideoViewHolder(ViewGroup parent) {
        super(parent, R.layout.home_video);
    }

    @Override
    public void onItemViewClick(Home_infoAll.ResultBean.VideoBean object) {
        super.onItemViewClick(object);
        Toast.makeText(itemView.getContext(),"点击了Video",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void setData(Home_infoAll.ResultBean.VideoBean object) {
        super.setData(object);
        tv1.setText(object.getTitle());
        tv2.setText(object.getPlayTimes()+"");
        Glide.with(itemView.getContext()).load(object.getThumbUrl()).into(iv);
    }

    @Override
    public void onInitializeView() {
        super.onInitializeView();
        iv=findViewById(R.id.home_video_iv);
        tv1=findViewById(R.id.home_video_tv1);
        tv2=findViewById(R.id.home_video_tv2);
    }
}
